package com.neusoft.bigdata.hbase.biz.impl;

import java.io.IOException;
import java.util.List;

import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Increment;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
import org.apache.hadoop.hbase.filter.WritableByteArrayComparable;
import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.regionserver.InternalScanner;
import org.apache.hadoop.hbase.regionserver.RegionScanner;
import org.apache.hadoop.hbase.regionserver.Store;
import org.apache.hadoop.hbase.regionserver.StoreFile;
import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;

import com.google.common.collect.ImmutableList;

/**
 * @author lihzh
 * @date 2013-3-28 下午2:22:23
 */
public class IndexCoprocessorImpl implements RegionObserver {

	@Override
	public void start(CoprocessorEnvironment env) throws IOException {
	}

	@Override
	public void stop(CoprocessorEnvironment env) throws IOException {
	}

	@Override
	public void preOpen(ObserverContext<RegionCoprocessorEnvironment> c) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void postOpen(ObserverContext<RegionCoprocessorEnvironment> c) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void preFlush(ObserverContext<RegionCoprocessorEnvironment> c) {
		
	}

	/**
	 * 在更新Metric表后，同时更新索引表
	 */
	@Override
	public void postFlush(ObserverContext<RegionCoprocessorEnvironment> c) {
	}

	@Override
	public void preCompactSelection(
			ObserverContext<RegionCoprocessorEnvironment> c, Store store,
			List<StoreFile> candidates) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void postCompactSelection(
			ObserverContext<RegionCoprocessorEnvironment> c, Store store,
			ImmutableList<StoreFile> selected) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public InternalScanner preCompact(
			ObserverContext<RegionCoprocessorEnvironment> c, Store store,
			InternalScanner scanner) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void postCompact(ObserverContext<RegionCoprocessorEnvironment> c,
			Store store, StoreFile resultFile) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void preSplit(ObserverContext<RegionCoprocessorEnvironment> c) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void postSplit(ObserverContext<RegionCoprocessorEnvironment> c,
			HRegion l, HRegion r) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void preClose(ObserverContext<RegionCoprocessorEnvironment> c,
			boolean abortRequested) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void postClose(ObserverContext<RegionCoprocessorEnvironment> c,
			boolean abortRequested) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void preGetClosestRowBefore(
			ObserverContext<RegionCoprocessorEnvironment> c, byte[] row,
			byte[] family, Result result) throws IOException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void postGetClosestRowBefore(
			ObserverContext<RegionCoprocessorEnvironment> c, byte[] row,
			byte[] family, Result result) throws IOException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void preGet(ObserverContext<RegionCoprocessorEnvironment> c,
			Get get, List<KeyValue> result) throws IOException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void postGet(ObserverContext<RegionCoprocessorEnvironment> c,
			Get get, List<KeyValue> result) throws IOException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean preExists(ObserverContext<RegionCoprocessorEnvironment> c,
			Get get, boolean exists) throws IOException {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean postExists(ObserverContext<RegionCoprocessorEnvironment> c,
			Get get, boolean exists) throws IOException {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void prePut(ObserverContext<RegionCoprocessorEnvironment> c,
			Put put, WALEdit edit, boolean writeToWAL) throws IOException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void postPut(ObserverContext<RegionCoprocessorEnvironment> c,
			Put put, WALEdit edit, boolean writeToWAL) throws IOException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void preDelete(ObserverContext<RegionCoprocessorEnvironment> c,
			Delete delete, WALEdit edit, boolean writeToWAL) throws IOException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void postDelete(ObserverContext<RegionCoprocessorEnvironment> c,
			Delete delete, WALEdit edit, boolean writeToWAL) throws IOException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean preCheckAndPut(
			ObserverContext<RegionCoprocessorEnvironment> c, byte[] row,
			byte[] family, byte[] qualifier, CompareOp compareOp,
			WritableByteArrayComparable comparator, Put put, boolean result)
			throws IOException {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean postCheckAndPut(
			ObserverContext<RegionCoprocessorEnvironment> c, byte[] row,
			byte[] family, byte[] qualifier, CompareOp compareOp,
			WritableByteArrayComparable comparator, Put put, boolean result)
			throws IOException {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean preCheckAndDelete(
			ObserverContext<RegionCoprocessorEnvironment> c, byte[] row,
			byte[] family, byte[] qualifier, CompareOp compareOp,
			WritableByteArrayComparable comparator, Delete delete,
			boolean result) throws IOException {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean postCheckAndDelete(
			ObserverContext<RegionCoprocessorEnvironment> c, byte[] row,
			byte[] family, byte[] qualifier, CompareOp compareOp,
			WritableByteArrayComparable comparator, Delete delete,
			boolean result) throws IOException {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public long preIncrementColumnValue(
			ObserverContext<RegionCoprocessorEnvironment> c, byte[] row,
			byte[] family, byte[] qualifier, long amount, boolean writeToWAL)
			throws IOException {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public long postIncrementColumnValue(
			ObserverContext<RegionCoprocessorEnvironment> c, byte[] row,
			byte[] family, byte[] qualifier, long amount, boolean writeToWAL,
			long result) throws IOException {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public Result preIncrement(ObserverContext<RegionCoprocessorEnvironment> c,
			Increment increment) throws IOException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Result postIncrement(
			ObserverContext<RegionCoprocessorEnvironment> c,
			Increment increment, Result result) throws IOException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public RegionScanner preScannerOpen(
			ObserverContext<RegionCoprocessorEnvironment> c, Scan scan,
			RegionScanner s) throws IOException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public RegionScanner postScannerOpen(
			ObserverContext<RegionCoprocessorEnvironment> c, Scan scan,
			RegionScanner s) throws IOException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean preScannerNext(
			ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s,
			List<Result> result, int limit, boolean hasNext) throws IOException {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean postScannerNext(
			ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s,
			List<Result> result, int limit, boolean hasNext) throws IOException {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void preScannerClose(
			ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s)
			throws IOException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void postScannerClose(
			ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s)
			throws IOException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void preWALRestore(
			ObserverContext<RegionCoprocessorEnvironment> ctx,
			HRegionInfo info, HLogKey logKey, WALEdit logEdit)
			throws IOException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void postWALRestore(
			ObserverContext<RegionCoprocessorEnvironment> ctx,
			HRegionInfo info, HLogKey logKey, WALEdit logEdit)
			throws IOException {
		// TODO Auto-generated method stub
		
	}

}
